package ONLINE_EXAM;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class baidu3 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s;
        while ((s= br.readLine())!= null){
            String[] nums = s.split(" ");
            int amount = Integer.valueOf(nums[0]);
            int len = Integer.valueOf(nums[1]);

            int num =1;
            for (int i = 1;i<= amount;i++){
                num *= i;
            }
            int res =num%1000000007;
            for (int i = 1; i <= len; i++) {
                res = (res* num)%1000000007;
            }
            System.out.println(res%1000000007);

        }
    }
}
